﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Xylee.Common
{
    /// <summary>
    /// Refers to the construction of when a visible 
    /// portal changes the view from the user. This will 
    /// allow the definition of next, previous, and changing 
    /// between portals much smoother as it involves 
    /// an event so that observers can monitor when these 
    /// changes are made. Once more, context can be obtained 
    /// from currently visible portals so that other visible 
    /// items change what the portal is monitoring in terms of 
    /// viewable context items.
    /// </summary> 
    public class PortalChangeEventArgs : EventArgs
    {
        private IPortal currentPortal;
        private IPortal previousPortal;
        private bool handled;

        /// <summary>
        /// Construct the portal change with a previous and 
        /// a current portal. The context of the switch, whether 
        /// backwards or forwards is irrelevant to this class; so 
        /// much that there is a change in the portal view itself 
        /// with a currently viewable area, with a previously viewable 
        /// area. It allows any viewer to cancel the change and return 
        /// to the previously viewed portal.
        /// </summary>
        /// <param name="previous"><seealso cref="IPortal"/> instance 
        /// that refers to the previously visible area for the user.</param>
        /// <param name="current"><seealso cref="IPortal"/> instance 
        /// that refers to the current and newly visible area for the user.</param>
        public PortalChangeEventArgs(IPortal previous, IPortal current)
        {
            this.currentPortal = current;
            this.previousPortal = previous;
        }

        /// <summary>
        /// Returns the currently visible portal view.
        /// </summary>
        public IPortal Current
        {
            get { return currentPortal; }
        }

        /// <summary>
        /// Returns the previously visible portal view.
        /// </summary>
        public IPortal Previous
        {
            get { return previousPortal; }
        }

        /// <summary>
        /// Returns or sets the value of whether or not 
        /// the change in view has been handled by the user, 
        /// this will allow further analysis to either stop or continue.
        /// </summary>
        public bool Handled
        {
            get { return handled; }
            set { this.handled = value; }
        }
    }
}
